package com.jianan.mis.data.domain.base;

import java.io.Serializable;


/**
 * This is an object that contains data related to the country_material table.
 * Do not modify this class because it will be overwritten if the configuration file
 * related to this class is modified.
 *
 * @hibernate.class
 *  table="country_material"
 */

public abstract class BaseCountryMaterial  implements Serializable {

	public static String REF = "CountryMaterial";


	// constructors
	public BaseCountryMaterial () {
		initialize();
	}

	/**
	 * Constructor for primary key
	 */
	public BaseCountryMaterial (
		com.jianan.mis.data.domain.Country country,
		com.jianan.mis.data.domain.Material material) {

		this.setCountry(country);
		this.setMaterial(material);
		initialize();
	}

	protected void initialize () {}



	private int hashCode = Integer.MIN_VALUE;

	// primary key

	private com.jianan.mis.data.domain.Country country;

	private com.jianan.mis.data.domain.Material material;



	/**
     * @hibernate.property
     *  column=country_id
	 * not-null=true
	 */
	public com.jianan.mis.data.domain.Country getCountry () {
		return this.country;
	}

	/**
	 * Set the value related to the column: country_id
	 * @param country the country_id value
	 */
	public void setCountry (com.jianan.mis.data.domain.Country country) {
		this.country = country;
		this.hashCode = Integer.MIN_VALUE;
	}

	/**
     * @hibernate.property
     *  column=material_id
	 * not-null=true
	 */
	public com.jianan.mis.data.domain.Material getMaterial () {
		return this.material;
	}

	/**
	 * Set the value related to the column: material_id
	 * @param material the material_id value
	 */
	public void setMaterial (com.jianan.mis.data.domain.Material material) {
		this.material = material;
		this.hashCode = Integer.MIN_VALUE;
	}





	public boolean equals (Object obj) {
		if (null == obj) return false;
		if (!(obj instanceof com.jianan.mis.data.domain.CountryMaterial)) return false;
		else {
			com.jianan.mis.data.domain.CountryMaterial countryMaterial = (com.jianan.mis.data.domain.CountryMaterial) obj;
			if (null != this.getCountry() && null != countryMaterial.getCountry()) {
				if (!this.getCountry().equals(countryMaterial.getCountry())) {
					return false;
				}
			}
			else {
				return false;
			}
			if (null != this.getMaterial() && null != countryMaterial.getMaterial()) {
				if (!this.getMaterial().equals(countryMaterial.getMaterial())) {
					return false;
				}
			}
			else {
				return false;
			}
			return true;
		}
	}

	public int hashCode () {
		if (Integer.MIN_VALUE == this.hashCode) {
			StringBuilder sb = new StringBuilder();
			if (null != this.getCountry()) {
				sb.append(this.getCountry().hashCode());
				sb.append(":");
			}
			else {
				return super.hashCode();
			}
			if (null != this.getMaterial()) {
				sb.append(this.getMaterial().hashCode());
				sb.append(":");
			}
			else {
				return super.hashCode();
			}
			this.hashCode = sb.toString().hashCode();
		}
		return this.hashCode;
	}


	public String toString () {
		return super.toString();
	}


}